/******************************************************************************
//             INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in accordance with the terms of that agreement.
//        Copyright (c) 2000-2001 Intel Corporation. All Rights Reserved.
//
//  Description:
//      Intel(R) JPEG library for X platform 
//
********************************************************************************/
#ifndef _IJX_H
#define _IJX_H

#include "impbase.h"

#include "ippjp.h"

#ifdef __cplusplus
extern "C" {
#endif
                     
/*
//  Criteria
*/
#define IJX_MAXCOMPONENT 4
#define IJX_MAXBLKINMCU  6

#define IJX_MAXENHUFFTABLES    2
#define IJX_MAXENQTTABLES      2
#define IJX_MAXDEHUFFTABLES    4
#define IJX_MAXDEQTTABLES      4

/*
//  Return code
*/
#define IJX_SUCCEEDED(x)   ((x)>=IJX_RTCODE_OK)

#define IJX_RTCODE_S_EOF                      2  // meet end
#define IJX_RTCODE_S_CONTINUE                 1  // continue
#define IJX_RTCODE_OK                         0  // ok
#define IJX_RTCODE_NO                        -2  // NO
#define IJX_RTCODE_BAGARG                    -1  // bag argument
#define IJX_RTCODE_ERROR                     -2  // general error
#define IJX_RTCODE_E_ERRPARSE                -3  // stream data parse error (data or markers)
#define IJX_RTCODE_E_ERRPARAM                -4  // error marker parameters.
#define IJX_RTCODE_E_ERRMEM                  -5  // memory error (unrecoverable)
#define IJX_RTCODE_W_INSUFFICIENTBUF         -6  // insufficient buffer space (recoverable)
#define IJX_RTCODE_W_UNDEFINEDMARKER         -7  // undefined marker in standard (recoverable).
#define IJX_RTCODE_W_NOTSUPPORTEDIDENT       -8  // not be supported identifies (recoverable).
#define IJX_RTCODE_E_NOTSUPPORTEDIDENT       -9  // not be supported identifies (unrecoverable).
#define IJX_RTCODE_W_NOTSUPPORTEDMARKER      -10 // The marker is not supported in this version (recoverable).
#define IJX_RTCODE_E_NOTSUPPORTEDMARKER      -11 // The marker is not supported in this version (recoverable).
#define IJX_RTCODE_E_NOTSUPPORTEDPRECISION   -12 // not be supported data precision (unrecoverable).
#define IJX_RTCODE_E_NOTSUPPORTEDSUBSAMPLING -13 // not be supported subsampling (unrecoverable).
#define IJX_RTCODE_E_NOTSUPPORTEDCOMPNUM     -14 // not be supported component numbers (unrecoverable).
#define IJX_RTCODE_E_NOTSUPPORTEDPARAM       -15 // not be supported image/jpeg mode or operation (unrecoverable).
#define IJX_RTCODE_E_WAVEMARKER              -16 // not be supported image/jpeg mode or operation (unrecoverable).
 

/*
//  JPEG mode
*/
#define IJX_MODE_NONE           0x0000
#define IJX_MODE_BASELINE       0x0001
#define IJX_MODE_BASELINE_A     0x0002
#define IJX_MODE_PROGRESSIVE    0x0004
#define IJX_MODE_MOTION_NONE    0x0000
#define IJX_MODE_MOTION_INDIV   0x0100
#define IJX_MODE_MOTION_DIFF    0x0200
#define IJX_MODE_MOTION_BRIEF   0x0400
#define IJX_MODE_MOTION_MASK    0xFF00
#define IJX_MODE_STILL_MASK     0x00FF

/*
// Operation Mode
*/
#define IJX_OP_SINGLE           1
#define IJX_OP_MULTIPLE         2

/*
//  Compress mode
*/
#define IJX_COMPRESS_MAXRATE    1
#define IJX_COMPRESS_MAXSPEED   2

/*
//  Time Stamp Mode
*/
#define IJX_TIME_COUNTER        1
#define IJX_TIME_DATE           2

typedef unsigned int UINT;
typedef int IJXRESULT;


/* Color Conversion */
typedef void (* PFUNCCOPYEXPAND_8U) (const Ipp8u *pSrc, 
                                      int srcStep,
                                      IppiSize srcSize,
                                      Ipp8u *pDst,
                                      int dstStep,
                                      IppiSize dstSize);
typedef void (* PFUNCCOPYROI_8U) ( const Ipp8u *pSrc, 
                                          int srcStep,
                                          Ipp8u *pDst,
                                          int dstStep,
                                          IppiSize roiSize);

typedef IppStatus (__STDCALL * PFUNCCCFWD_MCU_8U16S)  (const Ipp8u *pSrc, int srcStep, Ipp16s *pDst[]);
typedef IppStatus (__STDCALL * PFUNCCCINV_MCU_16S8U)  (const Ipp16s *pSrc[], Ipp8u *pDst, int dstStep);

/* Transform */
typedef void (* PFUNCTRANSFORMFWD_MCU_16S)(Ipp16s *paSrcDst[],
                                           const Ipp16u *paDCTQuantTable[]);
typedef void (* PFUNCTRANSFORMINV_MCU_16S)(const Ipp16s *paSrc[],
                                                  Ipp16s *paDst[],
                                           const Ipp32s *paDCTDequantTable[]);

/* Huffman coding */
typedef IJXRESULT (* PFUNCHUFFMANCODER_BLS)( const Ipp16s **pMCUBuf, 
                                             void   *pStreamState,
                                             void   *pEnCodeState);
typedef IJXRESULT (* PFUNCHUFFMANCODER_PDC)( Ipp16s **ppMCUBuf, 
                                             int ah,
                                             int al,
                                             void   *pStreamState,
                                             void   *pEnCodeState);
typedef IJXRESULT (* PFUNCGETHUFFMANFREQ)(const Ipp16s **ppMCUBuf, 
                                          int **ppFreq,
                                          void *pEncodeState);
typedef IJXRESULT (* PFUNCGETHUFFMANFREQ_PDC)(const Ipp16s **ppMCUBuf, 
                                              int **ppFreq,
                                              int ah,
                                              int al,
                                              void *pEncodeState);
/* Compress */
typedef IJXRESULT (*PFUNCODEC )( void   *pStream,
                                 void   *pEncodeState);

/* MCU Buffer */
typedef void (*PFUNCADJUSTMCUBUFFER) (void *pIJXBuffer, void *pMCUSpec);

typedef struct _IJXRECT
{
    int left;
    int top;
    int right;
    int bottom;
} IJXRECT;


typedef struct _IJAPP0_JFIF
{
   int  nVersion;     //Version Major, Minor	(2 bytes - 0x01, 0x01)
   int  Units;		  //(1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
   int  Xdpu;		  //(2 bytes - dots per unit horizontal)
   int  Ydpu;		  //(2 bytes - dots per unit vertical)
   int  nThumbWidth;
   int  nThumbHeight;
}IJAPP0_JFIF;

typedef struct _IJAPP0_JFXX
{
   int  nMode;        //0x10: JPEG; 0x11: 1byte/pixel; 0x13: 3byte/pixel;     
   int  nThumbWidth;  //Width  of Thumb. (Thumb is not supported in this version);
   int  nThumbHeight; //Height of Thumb. (Thumb is not supported in this version);
}IJAPP0_JFXX;

typedef struct _IJTIMESPEC
{
    int     nFlags;       //1: Time, 2: Date, The flags can be combined
                          //Decode need to check it with time marker length  
    Ipp32u  nTimeCounter; // Time
    Ipp8u   nDate[8];     // Date
}IJTIMESPEC;

typedef struct _IJMOTIONSPEC
{
    int nCodeMode;                //IJX_MODE_MOTION_INDIV only
    int nRate;                    //Playback rate
    int nFrameRSTInterval;        //0 only.
    int nFrameCount;              //Number of encoded frames.
}IJMOTIONSPEC;

typedef struct _IJENPROCESSSPEC
{
    PFUNCADJUSTMCUBUFFER          funcAdjustMCUBuf;
    PFUNCCOPYEXPAND_8U            funcCopyExpand;  
    PFUNCCCFWD_MCU_8U16S          funcMCUColorConvert;
    PFUNCTRANSFORMFWD_MCU_16S     funcMCUTransform;
    PFUNCODEC                     funcMotionDiffFirst;
    PFUNCODEC                     funcMotionDiffRefine;
    PFUNCODEC                     funcMotionDiffEncoder;
    PFUNCHUFFMANCODER_BLS         funcHuffmanEncoder;
    PFUNCHUFFMANCODER_PDC         funcHuffmanPDCEncoder;
    PFUNCGETHUFFMANFREQ_PDC       funcGetHuffmanDCFREQ;
    PFUNCGETHUFFMANFREQ           funcGetHuffmanFREQ;  
    PFUNCODEC                     funcCompress;  
} IJENPROCESSSPEC;

typedef struct _IJDEPROCESSSPEC
{
    PFUNCADJUSTMCUBUFFER          funcAdjustMCUBuf;
    PFUNCCOPYROI_8U               funcCopyROI;  
    PFUNCCCINV_MCU_16S8U          funcMCUColorConvert;
    PFUNCTRANSFORMINV_MCU_16S     funcMCUTransform;
    PFUNCODEC                     funcMotionDiffFirst;
    PFUNCODEC                     funcMotionDiffRefine;
    PFUNCODEC                     funcMotionDiffDecoder;
    PFUNCHUFFMANCODER_BLS         funcHuffmanDecoder;
    PFUNCHUFFMANCODER_PDC         funcHuffmanPDCDecoder;
    PFUNCODEC                     funcDecompress;  
} IJDEPROCESSSPEC;

typedef struct _IJTHUMBSPEC
{
    int   nMode;
    int   nWidth;
    int   nHeight;
    int   nStep;
    Ipp8u *pThumb;
} IJTHUMBSPEC;

typedef struct _IJMCUSPEC
{
    int nMCUWidth;           // MCU Width
    int nMCUHeight;          // MCU Height
    int nMCUPadWidth;        
    int nMCUPadHeight;
    int nImageMCUStep;       // no use   
    int nHMCUCount;
    int nVMCUCount;
    int nTotalMCUCount;
    int nBlksInMCU;          
    int naCoeffOffset[IJX_MAXCOMPONENT];
    int naBlksOffset[IJX_MAXCOMPONENT];
} IJMCUSPEC;


typedef struct _IJCOMPSPEC
{
    int nIdentifier;
    int nHSampling;
    int nVSampling;
    int nNumDataUnit;        
    int nQuantTableIndex;
    int nACHuffTableIndex;
    int nDCHuffTableIndex;
} IJCOMPSPEC;

typedef struct _IJFRAMESPEC
{
    int nSOF;
    int nPrecision;
    int nHeight;
    int nWidth; 
    int nNumComps;
} IJFRAMESPEC;

typedef struct _IJSCANSPEC
{
    int ss;
    int se;
    int ah;
    int al;
    int nNumComps;
    IJCOMPSPEC *ppCompSpec[IJX_MAXCOMPONENT];
} IJSCANSPEC;

typedef struct _IJPROGRESSIVESPEC
{
    int    nEOBRun;
    int    nValidBits;
    Ipp8u  bitBuffer[(256+1024+31)];
} IJPROGRESSIVESPEC;

typedef struct _IJBITTREAMSTATE
{
    int          nMaxBufLen;
    int          nUsedBufBitsLen; 
    Ipp32u       nPrefetchedBits;
    int          nNumValidPrefetchedBits;
    int          nMarker;
    Ipp8u        *pBitStream;
} IJBITTREAMSTATE;

typedef struct _IJCOUNTERSTATE
{
    int nScanCounter;
    int nFrameScanCounter;
    int nTotalFrameCounter;
    int nRSTCounter;
    int nDRICounter;
    int nProcessedBitsLen;
    int nMotionFrameCounter;
} IJCOUNTERSTATE;

typedef struct _IJHUFFMANTABLESPEC
{
    int   OTHERS[264];
    int   CODESIZE[264];
    Ipp8u BITS[36];

    Ipp8u huffBits[16];
    Ipp8u huffValue[257];

} IJHUFFMANTABLESPEC;

typedef struct _IJBUFFER
{
    int    nFlag;

    int    nMaxBufLen;

    /* Following items need to be initialized by IJX */
    Ipp16s *paImgCoeffBuf[IJX_MAXCOMPONENT];   
    Ipp16s *paImgCoeffBufCur[IJX_MAXCOMPONENT];

    Ipp16s *paMCUCoeffBuf[IJX_MAXCOMPONENT];
    Ipp16s *paMCUCoeffBufCur[IJX_MAXCOMPONENT];

    int     nCoeffBufLen;

    int    *pAuxFreqBuf;
    Ipp8u  *pAuxMCUDataTempBuf;
    int    nAuxBufLen;

    void   *paImageBuf[IJX_MAXCOMPONENT];
    void   *paImageBufCur[IJX_MAXCOMPONENT];
    int     naImageStep[IJX_MAXCOMPONENT];

} IJBUFFER;

typedef struct _IJENCODESTATE
{
    int                nStatus; 
    int                nQuality;
    int                nPrecision;
    Ipp32u             nJPEGCodeMode;
    int                nRstInterval; 
    int                nHMCUCurPos;
    int                nVMCUCurPos;

    Ipp16s             dcPred[IJX_MAXCOMPONENT];

    Ipp16u             *paIdxDCTQuantTable[IJX_MAXCOMPONENT];
    Ipp32s             *paIdxDCTDequantTable[IJX_MAXCOMPONENT];
    IppJPEGEnHuffTable *paIdxDCHuffTable[IJX_MAXCOMPONENT];
    IppJPEGEnHuffTable *paIdxACHuffTable[IJX_MAXCOMPONENT];

    Ipp16u             quantTable[64*IJX_MAXENQTTABLES];
    Ipp16u             dctQuantTable[64*IJX_MAXENQTTABLES];
    Ipp32s             dctDequantTable[64*IJX_MAXENQTTABLES];

    IppJPEGEnHuffTable dcHuffTable[IJX_MAXENHUFFTABLES];
    IppJPEGEnHuffTable acHuffTable[IJX_MAXENHUFFTABLES];

    IJBUFFER           bufSpec;

    IIPIMAGESPEC       imageSpec;
    IWPWAVESPEC        waveSpec;
    IJMOTIONSPEC       motionSpec;

    IJCOMPSPEC         compSpec[IJX_MAXCOMPONENT]; 
    IJMCUSPEC          mcuSpec;
    IJENPROCESSSPEC    procSpec;
    
    IJFRAMESPEC        frameSpec;
    IJSCANSPEC         scanSpec;

    IJPROGRESSIVESPEC  progSpec;    

    IJCOUNTERSTATE     counter;

}IJENCODESTATE;


typedef struct _IJDECODESTATE
{
    int                nStatus;       
    int                nLastMarker;
    int                nPrecision;
    Ipp32u             nJPEGCodeMode;
    int                nOperationMode;
    int                nDesiredImageMode;
    int                nRstInterval; // 0-7
    int                nDesiredMarker;
    int                nHMCUCurPos;
    int                nVMCUCurPos;
    
    Ipp16s             dcPred[IJX_MAXCOMPONENT];

    Ipp32s             *paIdxDCTDequantTable[IJX_MAXCOMPONENT];
    IppJPEGDeHuffTable *paIdxDCHuffTable[IJX_MAXCOMPONENT];
    IppJPEGDeHuffTable *paIdxACHuffTable[IJX_MAXCOMPONENT];

    Ipp32s             dctDequantTable[64*IJX_MAXDEQTTABLES];

    IppJPEGDeHuffTable dcHuffTable[IJX_MAXDEHUFFTABLES];
    IppJPEGDeHuffTable acHuffTable[IJX_MAXDEHUFFTABLES];

    IJBUFFER           bufSpec;

    IIPIMAGESPEC       imageSpec;
    IWPWAVESPEC        waveSpec;
    IJMOTIONSPEC       motionSpec;
    IJTIMESPEC         timeSpec;

    IJCOMPSPEC         compSpec[IJX_MAXCOMPONENT]; 
    IJMCUSPEC          mcuSpec;
    IJDEPROCESSSPEC    procSpec;

    IJFRAMESPEC        frameSpec;
    IJSCANSPEC         scanSpec;

    IJPROGRESSIVESPEC  progSpec;    

    IJCOUNTERSTATE     counter;

}IJDECODESTATE;

                           
/******************************************************************************
// Name:            ijxPrepareStream
// Description:     Init IJBITTREAMSTATE structure. 
// Input Arguments:
//      pStreamBuf: Points to stream data buffer
//   nStreamBufLen: Specifies stream data buffer length in byte. 
//          bReset: Identifies if reset stream buffer pointer.
// Output Arguments:
//         pStream: Points to IJBITTREAMSTATE structure.
//                     
//                  
******************************************************************************/
IJXRESULT ijxPrepareStream( Ipp8u           *pStreamBuf,
                            int             nStreamBufLen,
                            int             bReset,
                            IJBITTREAMSTATE *pStream );


/*----------------------------------Encoder---------------------------------*/

/******************************************************************************
// Name:            ijxCompressInit
// Description:     Init function for encoding.
// Input Arguments:
//        nQuality: Indicates quality of compressed image.
// nResartInterval: Indicates the number of resart interval.
//  nStillCodeMode: Indicates JPEG compress mode for still image (IJX_MODE_BASELINE or IJX_MODE_PROGRESSIVE).
//      pImageSpec: Points to IIPIMAGESPEC data structure.
//       pWaveSpec: Points to IWPWAVESPEC data structure.
//     pMotionSpec: Points to IJMOTIONSPEC data structure.
//         pStream: Identifies IJBITTREAMSTATE data structure.
// Output Arguments:
//    pEncodeState: Identifies IJENCODESTATE strcuture.
//                          
// Returns:          
//        [Success] IJX_RTCODE_OK
//        [Failure] IJX_RTCODE_BAGARG
//                  IJX_RTCODE_INSUFFICIENTBUF
//                  IJX_RTCODE_NOTSUPPORTMARKER
//                  IJX_RTCODE_ERRPARSE
//                  IJX_RTCODE_E_NOTSUPPORTEDPARAM   
//                  
******************************************************************************/
IJXRESULT ijxCompressInit( int nQuality,
                           int nRestartInterval,
                           int nStillCodeMode,
                           const IIPIMAGESPEC *pImageSpec,
                           const IWPWAVESPEC  *pWaveSpec,
                           const IJMOTIONSPEC *pMotionSpec,
                           IJBITTREAMSTATE *pStream,
                           IJENCODESTATE *pEncodeState);
/******************************************************************************
// Name:            ijxGetCompBufLen
// Description:     Get internal buffer length for encoding
// Input Arguments:
//    pEncodeState: Points to IJENCODESTATE data structure.
// Output Arguments:
//        pnBufLen: Points to int type which contains desired buffer length when function return.
//                  
******************************************************************************/
IJXRESULT ijxGetCompBufLen (int *pnBufLen, 
                           IJENCODESTATE *pEncodeState);
/******************************************************************************
// Name:            ijxCompBufInit
// Description:     Init all internal buffers for encoding
// Input Arguments:
//         pBufPtr: Points to the buffer which allocated by codec caller.
//         nBufLen: Specifies internal buffer length
// Output Arguments:
//    pEncodeState: Identifies IJENCODESTATE strcuture.
//                     
******************************************************************************/
IJXRESULT ijxCompBufInit(void *pBufPtr, 
                        int  nBufLen,
                        IJENCODESTATE *pEncodeState);
/******************************************************************************
// Name:            ijxCompress
// Description:     JPEG compress.
// Input Arguments:
//      ppImageBuf: Points to image buffer pointers.
//  pnImageBufStep: Points to array of image buffer step.
//         pStream: Identifies IJBITTREAMSTATE data structure.
//    pEncodeState: Identifies IJENCODESTATE strcuture.
//                          
// Returns:          
//        [Success] IJX_RTCODE_OK
//        [Failure] IJX_RTCODE_BAGARG
//                  IJX_RTCODE_INSUFFICIENTBUF
//                  IJX_RTCODE_NOTSUPPORTMARKER
//                  IJX_RTCODE_ERRPARSE
//                  
******************************************************************************/
IJXRESULT ijxCompress(void     **ppImageBuf,
                      int      *pnImageBufStep,  
                      IJBITTREAMSTATE *pStream,
                      IJENCODESTATE *pEncodeState);
/******************************************************************************
// Name:            ijxAddWaveStream
// Description:     Add wave stream into main code stream.
// Input Arguments:
//  pWaveStreamBuf: Points to wave stream buffer.
//     nByteLength: Specifies wave buffer length in bytes.
// Output Arguments:
//         pStream: Identifies IJBITTREAMSTATE data structure.
//                     
//                  
******************************************************************************/
IJXRESULT ijxAddWaveStream(void *ppWaveStreamBuf,
                           int  nByteLength,
                           IJBITTREAMSTATE *pStream);
/******************************************************************************
// Name:            ijxAddTimeStamp
// Description:     Add time stamp into main code stream
// Input Arguments:
//       pTimeSpec: Points to IJTIMESPEC data structure.
// Output Arguments:
//         pStream: Identifies IJBITTREAMSTATE data structure.
// Returns:          
//                     
//                  
******************************************************************************/
IJXRESULT ijxAddTimeStamp(IJTIMESPEC     *pTimeSpec,
                          IJBITTREAMSTATE *pStream);

/******************************************************************************
// Name:            ijxIsInMotionEncoding
// Description:     Used to Check if the current status is in Motion coding.
// Input Arguments:
//    pEncodeState: Identifies IJENCODESTATE strcuture.
// Output Arguments:
// Returns:          
//                     
//                  
******************************************************************************/
IJXRESULT ijxIsInMotionEncoding(IJENCODESTATE *pEncodeState);

/* Decoder */
/******************************************************************************
// Name:            ijxDecompressInit
// Description:     Init function for JPEG decompress.
// Input Arguments:
// nDesiredImageMode:
//                   Specifies desired output image mode.
//   nOperationMode: Specifies operation mode for single or multiple image.
// Output Arguments:
//          pStream: Points to IJBITTREAMSTATE structure.
//     pDecodeState: Points to IJDECODESTATE structure.
//                          
// Returns:          
//        [Success] IJX_RTCODE_OK
//        [Failure] IJX_RTCODE_BAGARG
//                  IJX_RTCODE_INSUFFICIENTBUF
//                  IJX_RTCODE_NOTSUPPORTMARKER
//                  IJX_RTCODE_ERRPARSE
//                     
//                  
******************************************************************************/
IJXRESULT ijxDecompressInit (int nDesiredImageMode,
                             int nOperationMode,
                             IJBITTREAMSTATE *pStream,
                             IJDECODESTATE *pDecodeState);

/******************************************************************************
// Name:            ijxGetDecompBufLen
// Description:     Use this function to get desired buffer length for decoding
// Input Arguments:
//     pDecodeState: Points to IJDECODESTATE structure.
// Output Arguments:
//         pnBufLen: Points to int type that define buffer length in byte.
//                  
******************************************************************************/
IJXRESULT ijxGetDecompBufLen (int *pnBufLen, 
                              IJDECODESTATE *pDecodeState);

/******************************************************************************
// Name:            ijxDecompBufInit
// Description:     Initialize all internal buffer for decoding.
// Input Arguments: 
//         pBufPtr: Points to internal buffer which allocated by codec caller. 
//        nBuffLen: Specifies the buffer length which is identified by pBufPtr.
// Output Arguments:
//     pDecodeState: Points to IJDECODESTATE structure.   
// 
//                     
******************************************************************************/
IJXRESULT ijxDecompBufInit(void *pBufPtr, 
                          int  nBufLen,
                          IJDECODESTATE *pDecodeState);

/******************************************************************************
// Name:            ijxDecompress
// Description:     Decompress JPEG image from code stream.
// Input Arguments:
//      ppImageBuf: Points to image buffer pointers.
//  pnImageBufStep: Points to array of image buffer step.
//         pStream: Identifies IJBITTREAMSTATE data structure.
// Output Arguments:
//     pDecodeState: Points to IJDECODESTATE structure.   
//                          
// Returns:          
//        [Success] IJX_RTCODE_OK
//        [Failure] IJX_RTCODE_BAGARG
//                  IJX_RTCODE_INSUFFICIENTBUF
//                  IJX_RTCODE_NOTSUPPORTMARKER
//                  IJX_RTCODE_ERRPARSE
//                     
//                  
******************************************************************************/
IJXRESULT ijxDecompress (void     **ppImageBuf,
                         int      *pnImageBufStep,  
                         IJBITTREAMSTATE *pStream,
                         IJDECODESTATE   *pDecodeState);

/******************************************************************************
// Name:            ijxGetWaveStream
// Description:     Find the wave stream 
// Input Arguments:
// ppWaveStreamBuf: Points to wave stream pointer.
//         pStream: Identifies IJBITTREAMSTATE data structure.
// Output Arguments:
//    pnByteLength: Points to int data type to specifies the length of wave stream in byte. 
//                  
******************************************************************************/
IJXRESULT ijxGetWaveStream(void **ppWaveStreamBuf,
                           int  *pnByteLength,
                           IJBITTREAMSTATE *pStream);

/******************************************************************************
// Name:            ijxGetTimeStamp
// Description:     Get Time Stamp from code stream.
// Input Arguments:
//     pDecodeState: Points to IJDECODESTATE structure.   
// Output Arguments:
//       ppTimeSpec: Points to the pointer of  IJTIMESPEC data structure.
//                     
//                  
******************************************************************************/
IJXRESULT ijxGetTimeStamp(IJTIMESPEC     **ppTimeSpec,
                          IJDECODESTATE  *pDecodeState);

/******************************************************************************
// Name:            ijxGetDecompressImageSpec
// Description:     Get Image parameters from code stream.
// Input Arguments:
//     pDecodeState: Points to IJDECODESTATE structure.   
// Output Arguments:
//      ppImageSpec: Points to the pointer of  IIPIMAGESPEC data structure.
//                     
//                  
******************************************************************************/
IJXRESULT ijxGetDecompressImageSpec(IIPIMAGESPEC **ppImageSpec,IJDECODESTATE *pDecodeState);

/******************************************************************************
// Name:            ijGetDecompressWaveSpec
// Description:     Get Wave parameters
// Input Arguments:
//     pDecodeState: Points to IJDECODESTATE structure.   
// Output Arguments:
//       ppWaveSpec: Points to the pointer of IWPWAVESPEC structure.
//                     
//                  
******************************************************************************/
IJXRESULT ijxGetDecompressWaveSpec(IWPWAVESPEC  **ppWaveSpec, IJDECODESTATE *pDecodeState);

/******************************************************************************
// Name:            ijGetDecompressMotionSpec
// Description:     Get Motion JPEG parameters from code stream
// Input Arguments: 
//     pDecodeState: Points to IJDECODESTATE structure.   
// Output Arguments:
//     ppMotionSpec: Points to IJMOTIONSPEC structure
//                     
//                  
******************************************************************************/
IJXRESULT ijxGetDecompressMotionSpec(IJMOTIONSPEC **ppMotionSpec, IJDECODESTATE *pDecodeState);

/******************************************************************************
// Name:            ijxIsInMotionDecoding
// Description:     Use this function to check current status if it is in motion decoding 
// Input Arguments:
//     pDecodeState: Points to IJDECODESTATE structure.   
// Output Arguments:
//                  
******************************************************************************/
IJXRESULT ijxIsInMotionDecoding(IJDECODESTATE *pDecodeState);

#ifdef __cplusplus
}
#endif

#endif
/* EOF */
